﻿#ifndef __QCDIALOG_H_
#define __QCDIALOG_H_


#include "QCLabel.h"


#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QDialog>
#include <QString>
#include <QIcon>

#define QCDIALOG_HEAD_HEIGHT 52
#define QCDIALOG_FOOT_HEIGHT 52
#define QCDIALOG_HEAD_BACKGROUND_COLOR "#E9F3FD"

class QCDialog : public QDialog
{
    Q_OBJECT
public:
    explicit QCDialog(QWidget *parent = 0);
    ~QCDialog();

private slots:
    virtual void onClose();
	virtual void onApply();
	virtual void onOK();
	virtual void onCancel();

protected:
    void paintEvent(QPaintEvent *);
    void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent * event);
    void mouseReleaseEvent(QMouseEvent *event);

public:
    void setSize(int w,int h);
    virtual void setQCGeometry(int x, int y, int w, int h);
	virtual void setMainWnd(QWidget* pWidget);
    void setQCTitle(const QString& s);
    void moveCenter(int screenWidth, int screenHeight);

	void resetStyle();

	void setShowApply(bool bShow);
	void setShowOK(bool bShow);
	void setShowCancel(bool bShow);

protected:
	QWidget* headBackGround;
    QLabel* headIcon;
	QLabel* headTitle;
    QPushButton* headCloseBtn;

	QWidget* m_pWidgetBKG;

	QWidget* m_pWidgetBKGFooter;
	QPushButton* m_pBtnApply;
	QPushButton* m_pBtnOK;
	QPushButton* m_pBtnCancel;

protected:
    int m_nWidth;
    int m_nHeight;

	bool m_bShowApply;
	bool m_bShowOK;
	bool m_bShowCancel;

	QWidget* mainWnd;

private:
	bool m_bDragging;
	int m_nLastClickX;
	int m_nLastClickY;
	QPoint m_ptPress;
};

#endif // __QCDIALOG_H_
